/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package examples;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.WindowConstants;


/**
 *
 * @author Kelly Ruiz
 */
public class JFramexample {
    
    public JFrame v;
    public JTextField mssj;
    private JButton boton;
     
    public static void main(String[] args) {
            
        new JFramexample();
    }

    public JFramexample() {
    
        mssj = new JTextField(20);
        boton = new JButton("Pulsa y muestra");
        v = new JFrame("Primera Ventana");
        //v.set  
        v.getContentPane().setLayout(new FlowLayout());
        v.getContentPane().add(mssj);
        v.getContentPane().add(boton);
        //v.add(boton);
        
        boton.addActionListener(new ActionListener() {

           // @Override
            public void actionPerformed(ActionEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                //String a;
                //System.out.println(mssj.getText());
                mssj.setText("ok");
                
            }
        });   
        
        v.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        v.setVisible(true);
    }
       
}
    
            
            
    
    
    
    

